package com.qfedu.springboot1.controller;

import com.qfedu.springboot1.service.WeatherService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 千锋Java,为你而生！
 *
 * @Author: Feri
 * @Date:2024/10/31 14:56
 * @Modified:
 */
@RestController // IOC 创建 对象 ，内部方法返回值转为json格式
@RequestMapping("api/weather") //设置请求路径
@Tag(name="天气接口")
public class WeatherController {
    @Autowired //IOC 属性注入 赋值  实际上：WeatherServiceImpl
    private WeatherService service;

    @GetMapping("city") //设置请求路径，get请求
    public String city(String city){
        return service.queryByCity(city);
    }
}
